package org.huawei260.TiKu.ODsuanfa;

import java.util.Arrays;

/**
 * @Author: qingle
 * @Date: 2024/10/28-16:11
 * @Description: 3150 【贪心】2024E-变换最小字符串
 * @version: 1.0
 */
import java.util.Scanner;
public class E_2024E_3150__贪心_变换最小字符串 {

//	public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			System.out.println(getResult(sc.nextLine()));
		}

		public static String getResult(String s) {
			char[] minSArr = s.toCharArray();
			Arrays.sort(minSArr);

			String minS = new String(minSArr);
			if (minS.equals(s)) return s;

			char[] sArr = s.toCharArray();

			for (int i = 0; i < s.length(); i++) {
				if (sArr[i] != minSArr[i]) {
					char tmp = sArr[i];
					sArr[i] = minSArr[i];

					int swapIndex = s.lastIndexOf(minSArr[i]);
					sArr[swapIndex] = tmp;
					break;
				}
			}

			return new String(sArr);
		}
	}